package com.xyw.code.platform.webapps.config;

import lombok.EqualsAndHashCode;
import lombok.Getter;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @Classname DataScope
 * @Description 数据权限查询参数
 * Created by xuyiwei on 2019/7/30.
 */
@Getter
@EqualsAndHashCode(callSuper = true)
public class DataScope extends HashMap implements Serializable {

    /**
     * 限制范围的字段名称
     */
    private String scopeName = "dept_id";

    /**
     * 具体的数据范围
     */
    private List<Long> deptIds = new ArrayList<>();

    /**
     * 是否只查询本部门
     */
    private Boolean isOnly = false;

    public DataScope() {
        this.put("scopeName","dept_id");
        this.put("deptIds",new ArrayList<>());
        this.put("isOnly",false);
    }

    public void setScopeName(String scopeName) {
        this.scopeName = scopeName;
        this.put("scopeName","dept_id");
    }

    public void setDeptIds(List<Long> deptIds) {
        this.deptIds = deptIds;
        this.put("deptIds",new ArrayList<>());
    }

    public void setOnly(Boolean only) {
        isOnly = only;
        this.put("isOnly",false);
    }
}